package com.cheer.ba.view.activity;

import android.view.LayoutInflater;
import android.view.View;

import com.cheer.ba.R;
import com.cheer.ba.model.NewPayCipherModel;
import com.cheer.ba.model.NewPayModel;
import com.cheer.ba.presenter.impl.NewPayPresenter;
import com.cheer.ba.view.base.BaseCommAty;
import com.google.gson.Gson;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 新生支付
 * Created by Hq on 2017/7/17.
 */
public class NewCardPayAty extends BaseCommAty {

    @Override
    public View loadView(LayoutInflater inflater, View childView) {
        return super.loadView(inflater, inflater.inflate(R.layout.aty_new_cardpay, null, false));
    }

    @Override
    public void initPresenter() {
        presenter = new NewPayPresenter();
    }

    @Override
    public void initView() {

    }

    @Override
    public void initData() {

    }

    @OnClick(R.id.id_new_pay_btn)
    public void onClick(View mView) {
        switch (mView.getId()) {
            case R.id.id_new_pay_btn:
                String time = System.currentTimeMillis() + "";
                ((NewPayPresenter) presenter).getNewPayOrder(time, time, getMsgCipher(), getMsgCipher());
                break;
        }
    }

    /**
     * 获得报文密文
     */
    public String getMsgCipher() {
        NewPayCipherModel model = new NewPayCipherModel();
        model.payType = "1CCB";
        model.cardType = "1";
        model.bankCode = "CCB";
        model.merUserId = "11000003177";
        model.merUserIp = "192.168.1.1";
        Gson gson = new Gson();
        String msgCipher = gson.toJson(model);
        return msgCipher;
    }
}
